package com.jjx.trainingapi.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.jjx.trainingapi.common.RT;
import com.jjx.trainingapi.entity.vo.DataVProportionVo;
import com.jjx.trainingapi.entity.vo.DataVTopDataVo;
import com.jjx.trainingapi.service.DatavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LoveHuahua
 * @date 2022年05月24日 11:37
 * @description believe in yourself
 */
@RestController
@RequestMapping("/datav")
@SaCheckLogin
public class DataVController {

    @Autowired
    DatavService datavService;

    /**
     * 获取平台前10名
     *
     * @return
     */
    @PostMapping("/getTopData")
    public RT<List<DataVTopDataVo>> getTopData() throws InterruptedException {
        Thread.sleep(200);
        return RT.ok(datavService.getTopData(10));
    }


    /**
     * 大一/二/三/四 等级 占比
     *
     * @return
     */
    @PostMapping("/getProportion")
    public RT<List<DataVProportionVo>> getProportion() throws InterruptedException {
        Thread.sleep(200);
        return RT.ok(datavService.getProportion());
    }


    /**
     * 近七天刷题人数
     *
     * @return
     */
    @PostMapping("/getPersonCount")
    public RT getPersonCount() throws InterruptedException {
        Thread.sleep(200);
        return RT.ok(datavService.getPersonCount());
    }
}
